package com.danco.training.zaneuskaya.connection.dao;


import java.sql.SQLException;
import java.util.Date;
import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Session;

import com.danco.training.zaneuskaya.domain.Book;
import com.danco.training.zaneuskaya.domain.Order;

public interface OrderDao extends GenericDao<Order, Integer> {

	public List<Order> readExecutedOrders(Session session)  throws HibernateException;

	public List<Order> readNotExecutedOrders(Session session) throws HibernateException;

	public List<Order> readExecutedOrdersForPeriod(Session session,
			Date from, Date to) throws HibernateException;

	public List<Order> readOrdersSortedByOrderDate(Session session) throws HibernateException;

	public List<Order> readOrdersSortedByTotalPrice(Session session) throws HibernateException;

	public List<Order> readOrdersSortedByOrderState(Session session) throws HibernateException;

	public List<Order> readExecutedOrdersSortedByOrderDate(
			Session session, Date from, Date to) throws HibernateException;

	public List<Order> readExecutedOrdersSortedByPrice(Session session,
			Date from, Date to) throws HibernateException;

	public boolean addBookOrder(Session session, Order order, Book book) throws HibernateException;

	public boolean removeBookOrder(Session session, Order order, Book book) throws HibernateException;

	public boolean executeOrder(Session session, Integer id) throws HibernateException;
	
	public List<Order> findOrderByBook(Session session, Book book) throws HibernateException;
	
	public List<Book> findBooksByOrderId (Session session, Integer id ) throws HibernateException;
	
	public boolean deleteOrderByBookFromOrderBook (Session session, Book book) throws HibernateException ;
}
